<template>
    <div>
        <!-- 订票 -->
        <!--  -->
        <el-row>
            <el-col :span="24">
                <el-row>
                    <el-col :span="24" >

                    </el-col>
                </el-row>
                <ul class="fun-ul">

                </ul>
            </el-col>
        </el-row>
        <!--  -->
        <el-row class="msg1-container">
            <!-- 左侧表单 -->
            <el-col :span="11">
                <el-row>
                    <el-col :span="24" class="book-form-container">
                        <FormData :ob="classMsg" :op="classOption"></FormData>
                        <button class="check-btn form-btn order-btn" @click="check"><img src="../../assets/imgs/operation_btn_icon_tijiao_default.png" alt="" class="btn-img">提交订单</button>
                        <button class="check-btn form-btn lock-btn" @click="check"><img src="../../assets/imgs/operation_icon_suowei_default.png" alt="" class="btn-img">锁定座位</button>


                    </el-col>

                </el-row>


            </el-col>
            <!-- 右侧表格 -->
            <el-col :span="9" class="book-right-table">
                <TableData :data="msgList[0].data" :option="msgList[0].option" class="rig-table"></TableData>
            </el-col>
        </el-row>



        <!-- 详情表格栏 -->
        <el-row class="detail2-container">
            <!-- 左侧表格栏 -->
            <el-col :span="19" class="left-table">
                <TableData :data="detailsList[0].data" :option="detailsList[0].option"></TableData>
            </el-col>
            <!-- 右侧图 -->
            <el-col :span="5" class="right-img"></el-col>
        </el-row>



    </div>
</template>

<script>
    import FormData from "../../components/common/form";
    import TableData from "../../components/common/tableData";
    import qs from "qs";
    const DIC = {
        station: [],
    };
    export default {
        data: function() {
            return {
                classMsg: {},
                classOption: {
                    dicData: DIC,
                    column: [
                        {
                            label: "乘车日期",
                            prop: "date",
                            type: "date",
                            span: 15
                        },
                        {
                            label: "到站",
                            prop: "endSta",
                            type: "select",
                            dicData: "station",
                            span: 9
                        },
                        {
                            label: "员工票",
                            prop: "freeChild",
                            span: 6
                        },
                        {
                            label: "全票",
                            prop: "half",
                            span: 6
                        },
                        {
                            label: "优惠票",
                            prop: "price",
                            span: 6
                        },
                        {
                            label: "回程票",
                            prop: "backPrice",
                            span: 6
                        },
                        {
                            label: "景点套票",
                            prop: "taoTicket",
                            span: 6
                        },
                        {
                            label: "半票",
                            prop: "fullTicket",
                            span: 6
                        },
                        {
                            label: "春运票",
                            prop: "SpringTicket",
                            span: 6
                        },
                        {
                            label:"内部票",
                            prop:"insideTicket",
                            span:6
                        },
                        {
                            label:"双程票",
                            prop:"doubleTicket",
                            span:6
                        },
                        {
                            label:"军残票",
                            prop:"soliderTicket",
                            span:6
                        },
                        {
                            label:"老人票",
                            prop:"elderTicket",
                            span:6
                        },
                        {
                            label:"学生票",
                            prop:"studentTicket",
                            span:6
                        },
                        {
                            label:"订单金额:",
                            prop:"order",
                            span:10
                        },


                    ]

                },
                msgList: [
                    {
                        data: [],
                        option: {
                            page: true,
                            stripe: true,
                            menu: false,
                            align: "center",
                            menuAlign: "center",
                            column: []
                        }
                    }
                ],

                detailsList: [
                    {
                        data: [],
                        option: {
                            page: true,
                            stripe: true,
                            menu: false,
                            align: "center",
                            menuAlign: "center",
                            column: []
                        }
                    }
                ],


                currentRow:""
            };
        },
        methods: {
            stationDIC() {
                this.$http
                    .post(
                        "/tks/sale/saleStations?sortOrder=code%2Cspell"
                    )
                    .then(data => {
                        console.log(data)
                        for (var item of data.data) {
                            DIC.station.push({
                                label: item.name,
                                value: item.code
                            });
                        }
                    });
            },

           /* getMsgList() {
                this.msgList[0].data=[];
                this.$http
                    .post("/tks/booking/buslist")
                    .then(data => {
                        for (var item of data.data.list) {
                            this.msgList[0].data.push({
                                : item.
                                bus_time: item.bus_time,
                                busid: item.busid,
                                seatno: item.seatno,
                                pricetype: item.pricetype,
                                price: item.price,
                                stname: item.stname
                            });
                        }
                    });
            },*/
            getDetailsList() {
                this.detailsList[0].data=[];
                this.$http
                    .post("/tks/sale/dailyDetail")
                    .then(data => {
                        for (var item of data.data.list) {
                            this.detailsList[0].data.push({
                                stname: item.stname,
                                id: item.id,
                                bus_time: item.bus_time,
                                price: item.price,
                                pay_type: item.pay_type,
                                seatno: item.seatno,
                                statusname: item.statusname,
                                pricetype: item.pricetype,
                                busid: item.busid,
                                credential_owner: item.credential_owner,
                                time: "",
                                boarding_org: item.boarding_org
                            });
                        }
                    });
            },
            tableCreate() {
                this.msgList[0].option.column=[];
                this.msgList[0].option.column.push(
                    {
                        label: "日期",
                        prop: "bus_date"
                    },
                    {
                        label: "时间",
                        prop: "bus_time"
                    },
                    {
                        label: "班次",
                        prop: "busid"
                    },
                    {
                        label: "站点",
                        prop: "seatno"
                    },
                    {
                        label: "座位",
                        prop: "pricetype"
                    },
                    {
                        label: "票型",
                        prop: "price"
                    },
                    {
                        label: "票价",
                        prop: "stname"
                    }
                );
            },
            tableIICreate() {
                this.detailsList[0].option.column=[];
                this.detailsList[0].option.column.push(
                    {
                        label: "线路",
                        prop: "stname"

                    },
                    {
                        label: "班次",
                        prop: "id"

                    },
                    {
                        label: "时间",
                        prop: "bus_time"
                    },
                    {
                        label: "票价",
                        prop: "price"
                    },
                    {
                        label: "余售",
                        prop: "pay_type"
                    },
                    {
                        label: "状态",
                        prop: "seatno"
                    },
                    {
                        label: "需时",
                        prop: "statusname"
                    },
                    {
                        label: "车型",
                        prop: "pricetype"
                    },




                );
            },

            cancel() {
                this.modualShow = false;
            },
            check() {
                this.getTicketTable();

            },


            rowChange(){},
            rowChangeSell(val){
                this.currentRow=val.id;
            }
        },
        computed: {},
        components: { FormData, TableData },
        watch: {},
        mounted() {
            this.$emit("sendTag",6);
            this.stationDIC();
            this.tableCreate();
            this.tableIICreate();
            this.getMsgList();
            this.getDetailsList();
        }
    };

</script>
<style scoped src="../../assets/css/book/book.css">
</style>
    